package troisdimension.client;

import com.google.gwt.canvas.dom.client.Context2d;

public class Cercle extends Forme{
	
	protected int rayon = 2;
	protected int debutAngle = 0;
	protected int finAngle = 360;

	public Cercle(String id,Point point,int rayon, String couleur,PointCentral ptC) {
		this(id,point,rayon,couleur);
		this.setPtCentral(ptC);
	}
	
	public Cercle(String id,Point point,int rayon, String couleur) {
		this(id,point,rayon);
		this.setCouleur(couleur);
	}
	
	public Cercle(String id,Point point,int rayon) {
		this(id,point);
		this.setRayon(rayon);
	}	

	public Cercle(String id, Point point) {
	    super.setId(id);	
		super.setPt(point);	
	}

	public void dessiner(Context2d ctx){
		this.getTransforme().transformer(this.getPtCentral());
		ctx.beginPath();
		ctx.setFillStyle(this.getCouleur());
		ctx.arc(this.getPt().getX2d(), this.getPt().getY2d(), this.getRayon(), this.getDebutAngle(), this.getFinAngle(), false);
		ctx.fill();
		ctx.closePath();
	}
	
	public int getRayon() {
		return rayon;
	}

	public void setRayon(int rayon) {
		this.rayon = rayon;
	}
	
	public int getDebutAngle() {
		return debutAngle;
	}

	public void setDebutAngle(int debutAngle) {
		this.debutAngle = debutAngle;
	}
	
	public int getFinAngle() {
		return finAngle;
	}

	public void setFinAngle(int finAngle) {
		this.finAngle = finAngle;
	}
	
	public void apparence(Context2d ctx){
		ctx.arc(this.getPt().getX2d(), this.getPt().getY2d(), this.getRayon(), this.getDebutAngle(), this.getFinAngle(), false);
	}
}
